package com.google.code.mergeinformer.model;

import java.util.Locale;

/**
 * @author Alexander Shergin
 */
public enum Language {
    RU(new Locale("ru"), "Русский"),
    EN(new Locale("en"), "English");

    private final Locale locale;
    private final String languageName;

    private Language(Locale locale, String languageName) {
        this.locale = locale;
        this.languageName = languageName;
    }

    public Locale getLocale() {
        return locale;
    }

    public String getLanguageName() {
        return languageName;
    }

    public static Language getLanguage(Locale locale) {
        return Language.valueOf(locale.getLanguage().toUpperCase().trim());
    }
}
